package com.intelligent.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;

/**
 * 库存明细表
 * @TableName inventory_details
 */
@TableName(value ="inventory_details")
@Data
public class InventoryDetails implements Serializable {
    /**
     * 记录ID（自增主键）
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 库存编号
     */
    private String inventoryNo;

    /**
     * 产品名称
     */
    private Long productId;

    /**
     * 分类(0 成品 1 半成品)
     */
    private Integer category;

    /**
     * 单位
     */
    private Integer unitId;

    /**
     * 来源
     */
    private String source;

    /**
     * 所属仓库
     */
    private Long warehouseId;

    /**
     * 数量
     */
//    private Long quantity;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        InventoryDetails other = (InventoryDetails) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getInventoryNo() == null ? other.getInventoryNo() == null : this.getInventoryNo().equals(other.getInventoryNo()))
            && (this.getProductId() == null ? other.getProductId() == null : this.getProductId().equals(other.getProductId()))
            && (this.getCategory() == null ? other.getCategory() == null : this.getCategory().equals(other.getCategory()))
            && (this.getUnitId() == null ? other.getUnitId() == null : this.getUnitId().equals(other.getUnitId()))
            && (this.getSource() == null ? other.getSource() == null : this.getSource().equals(other.getSource()))
            && (this.getWarehouseId() == null ? other.getWarehouseId() == null : this.getWarehouseId().equals(other.getWarehouseId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getInventoryNo() == null) ? 0 : getInventoryNo().hashCode());
        result = prime * result + ((getProductId() == null) ? 0 : getProductId().hashCode());
        result = prime * result + ((getCategory() == null) ? 0 : getCategory().hashCode());
        result = prime * result + ((getUnitId() == null) ? 0 : getUnitId().hashCode());
        result = prime * result + ((getSource() == null) ? 0 : getSource().hashCode());
        result = prime * result + ((getWarehouseId() == null) ? 0 : getWarehouseId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", inventoryNo=").append(inventoryNo);
        sb.append(", productId=").append(productId);
        sb.append(", category=").append(category);
        sb.append(", unitId=").append(unitId);
        sb.append(", source=").append(source);
        sb.append(", warehouseId=").append(warehouseId);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
